import req from '@/utils/request.js';
import * as URL from '@/constants/api.js';
// 商品分类
export function getCategory(id) {
  return req({
    url: URL.CATEGORY,
    params: {
      id,
    },
  })
    .then((res) => res.data.result)
    .catch(() => []);
}
// 商品二级分类
export function getSubCategoryFilterGoods(id) {
  return req({
    url: URL.SUB_CATEGORY_FILTER_GOODS,
    params: {
      id,
    },
  })
    .then((res) => res.data.result)
    .catch(() => []);
}
// 懒加载分类
export function getSubCategoryGoods(params) {
  return req({
    url: URL.SUB_CATEGORY_GOODS,
    method: 'post',
    data: params,
  }).then((res) => res.data.result);
}

